import 'package:flutter/material.dart';
import 'package:flutter_base_plugin/flutter_base_plugin.dart';
import 'package:flutter_swiper/flutter_swiper.dart';

import '../../config/k_color.dart';

/// @author:  JoeKai
/// @date 2022/6/26 16:32
/// @explain：

class HomeNewsBulletin extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    final list = [
      "洞庭西望楚江分",
      "水尽南天不见云",
      "日落长沙秋色远",
      "不知何处吊湘君",
    ];

    return Container(
      decoration: BoxDecoration(
          color: Colors.white, borderRadius: BorderRadius.circular((10.r))),
      margin: EdgeInsets.all(15.h),
      width: double.infinity,
      height: 60.h,
      padding: EdgeInsets.only(left: 15.w, right: 15.w),
      child: Stack(
        alignment: AlignmentDirectional.centerStart,
        children: [
          Positioned(
            left: 0,
            child: Text(
              "新闻简报",
              style: TextStyle(fontSize: 35.sp),
            ),
          ),
          Positioned(
            left: 140.w,
            child: Container(
              height: 50.h,
              width: 3.w,
              color: KColors.appBarColor,
              margin: EdgeInsets.only(left: 15.w, right: 15.w),
            ),
          ),
          Positioned(
            left: 170.w,
            right: 0,
            top: 0,
            bottom: 0,
            child: Swiper(
              itemCount: list.length,
              scrollDirection: Axis.vertical,
              autoplay: true,
              itemBuilder: (context, index) {
                return InkWell(
                    onTap: () {
                      ToastUtils.show(list[index]);
                    },
                    child: Container(
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            list[index],
                            style: TextStyle(
                              fontSize: 28.sp,
                              color: KColors.hotDotTextColor,
                            ),
                            maxLines: 1,
                          ),
                          const Icon(Icons.keyboard_arrow_right)
                        ],
                      ),
                    ));
              },
            ),
          )
        ],
      ),
    );
  }

}

